<template>
<div class="war">
    <div class="box">
      <!-- <div class="imgs">
        <img src="../images/logo.jpg" alt="">
      </div> -->
    <el-form :rules="loginFormRules" ref="loginFormRef" class="login_form" label-width="80px" :model="loginForm">
      <el-switch
          style="display: block;height: 40px;"
          v-model="value2"
          active-color="#13ce66"
          inactive-color="#ff4949"
          active-text="注册"
          inactive-text="登录">
      </el-switch>
      <!--        用户名-->
      <el-form-item prop="username" label="用户名">
        <el-input v-model="loginForm.username"></el-input>
      </el-form-item>
      <!--        密码-->
      <el-form-item prop="password" label="密码">
        <el-input type="password" v-model="loginForm.password"></el-input>
      </el-form-item>
      <!--        按钮区-->
      <el-form-item class="btns">
        <el-button type="primary" @click="login">登录</el-button>
        <el-button type="info" @click="resetLoginForm">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</div>
</template>

<script>
export default {
  name: 'LoginVue',
  data () {
    return {
      value2: true,
      loginForm: {
        // 登录的表单数据的绑定对象
        username: '',
        password: ''
      },
      loginFormRules: {
        // 验证用户名是否合法
        username: [
          { required: true, message: '请输入登录名称', trigger: 'blur' },
          { min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' }
        ],
        // 验证密码是否合法
        password: [
          { required: true, message: '请输入登录密码', trigger: 'blur' },
          { min: 6, max: 15, message: '长度在 6 到 15 个字符', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {
    resetLoginForm () {
      // 点击重置按钮,重置登录表单
      // this.$refs[loginFormRef].resetFields()
      // this.$refs.loginFormRef.resetFields()
      this.loginForm.username = ''
      this.loginForm.password = ''
    },
    login () {
    }
  }
}
</script>

<style lang="stylus">
*{
  margin 0px
  padding 0px
}
.war{
  width 100vw
  height 100vh
  background url(../images/BGimg.webp) no-repeat center center/cover
  overflow hidden
}
.box {
  width: 500px;
  height 300px
  position absolute
  left 50%
  top 50%
  transform: translate(-50%,-50%)
  display: flex
  border: 1px solid #5E7DB9
  background-color #5E7DB9
}
.login_form{
  width 400px
  margin auto
  margin-top 60px
}
</style>
